<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Prawnto::TemplateHandlers::Raw</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Prawnto::TemplateHandlers::Raw</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/prawnto/lib/prawnto/template_handlers/raw_rb.html">
                vendor/plugins/prawnto/lib/prawnto/template_handlers/raw.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Base.html">
                Base
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000015">compile</a>&nbsp;&nbsp;
      <a href="#M000016">massage_template_source</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">GENERATE_REGULAR_EXPRESSION</td>
          <td>=</td>
          <td class="context-item-value">/^\s*Prawn\:\:Document\.generate(\(?)(.*?)(\,(.*))?(\s*\)?\s+do(.*?))$/m</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
attr_reader :run_environment

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">RENDER_FILE_REGULAR_EXPRESSION</td>
          <td>=</td>
          <td class="context-item-value">/(\w+)\.render_file\(?(.*?)\)?\s*$/</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000015" class="method-detail">
        <a name="M000015"></a>

        <div class="method-heading">
          <a href="#M000015" class="method-signature">
          <span class="method-name">compile</span><span class="method-args">(template)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000015-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handlers/raw.rb, line 5</span>
 5:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">template</span>)
 6:         <span class="ruby-comment cmt">#TODO: what's up with filename here?  not used is it?</span>
 7:         <span class="ruby-identifier">source</span>,<span class="ruby-identifier">filename</span> = <span class="ruby-identifier">massage_template_source</span>(<span class="ruby-identifier">template</span>)
 8:         <span class="ruby-value str">&quot;_prawnto_compile_setup;&quot;</span> <span class="ruby-operator">+</span>
 9: <span class="ruby-comment cmt">#        (filename ? &quot;@prawnto_options[:filename] = filename&quot; : &quot;&quot;) +</span>
10:         <span class="ruby-identifier">source</span>
11:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000016" class="method-detail">
        <a name="M000016"></a>

        <div class="method-heading">
          <a href="#M000016" class="method-signature">
          <span class="method-name">massage_template_source</span><span class="method-args">(template)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000016-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handlers/raw.rb, line 37</span>
37:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">massage_template_source</span>(<span class="ruby-identifier">template</span>)
38:         <span class="ruby-identifier">source</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">source</span>.<span class="ruby-identifier">dup</span>
39:         <span class="ruby-identifier">variable_name</span> = <span class="ruby-value str">'_pdf'</span>
40:         <span class="ruby-identifier">filename</span> = <span class="ruby-keyword kw">nil</span>
41:         
42:         <span class="ruby-identifier">source</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">/^(\s*?)(\$LOAD_PATH)/</span>, <span class="ruby-value str">'\1#\2'</span>
43:         <span class="ruby-identifier">source</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">/^(\s*?)(require\(?\s*['&quot;]rubygems['&quot;]\s*\)?\s*)$/</span>, <span class="ruby-value str">'\1#\2'</span>
44:         <span class="ruby-identifier">source</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">/^(\s*?)(require\(?\s*['&quot;]prawn['&quot;]\s*\)?\s*)$/</span>, <span class="ruby-value str">'\1#\2'</span>
45: 
46:         <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">source</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">GENERATE_REGULAR_EXPRESSION</span>)
47:           <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">$2</span>
48:           <span class="ruby-identifier">source</span>.<span class="ruby-identifier">sub!</span> <span class="ruby-constant">GENERATE_REGULAR_EXPRESSION</span>, <span class="ruby-node">&quot;#{variable_name} = Prawn::Document.new\\1\\4\\5&quot;</span>
49:         <span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">source</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">RENDER_FILE_REGULAR_EXPRESSION</span>)
50:           <span class="ruby-identifier">variable_name</span> = <span class="ruby-identifier">$1</span>
51:           <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">$2</span>
52:           <span class="ruby-identifier">source</span>.<span class="ruby-identifier">sub!</span> <span class="ruby-constant">RENDER_FILE_REGULAR_EXPRESSION</span>, <span class="ruby-value str">'#\0'</span>
53:         <span class="ruby-keyword kw">end</span>
54:         <span class="ruby-identifier">source</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">/^(\s*)(class\s|def\s).*?\n\1end/</span><span class="ruby-identifier">m</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
55:           <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;class &lt;&lt;@run_environment; #{match}; end;&quot;</span>
56:           <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">match</span>.<span class="ruby-identifier">count</span>(<span class="ruby-value str">&quot;\n&quot;</span>)
57:         <span class="ruby-keyword kw">end</span>
58:         <span class="ruby-identifier">source</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;\n[#{variable_name}.render,#{filename}]\n&quot;</span>
59:         <span class="ruby-identifier">source</span>
60:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>